
#include "socket/tcpip/Socket_TCPIP.h"
// IPC
#include "./ipc/mmap/MMAP_IO.cpp"



/**
 *  accept one client, the result's format.
 */
struct Accept_Info
{
    int event;
    int client_fd;
    int server_fd;
    int epoll_fd;
    char* remark;
    char* data;
    
    Accept_Info();
};
void procExit01(void)
{
    printf("\n before main process exit..! \n");
}

/*
 * 
 */
int main(int argc, char** argv) {

    printf("Start!!  \n");
    
    MMAP_IO<Accept_Info>* m_pIPC_mmap = new MMAP_IO<Accept_Info>();
    char filepath[] = "./epoll_accept.in";
    m_pIPC_mmap->initFd(filepath);
    m_pIPC_mmap->initPtr(0);
    
    Accept_Info* _accept;
    
    m_pIPC_mmap->memread(_accept);
    
    for(int i = 0;i<10;i++)
    {
         printf( "clientfd: %d serverfd %d;\n",(*(_accept+i)).client_fd, (*(_accept+i)).server_fd );
    }
    

    if(atexit(procExit01)!=0)
    {
        printf("atexit method failed..! \n");
    }

    return (EXIT_SUCCESS);
}